package com.data4.feignapi.client;

import com.data4.feignapi.dto.OrderDTO;
import com.data4.feignapi.dto.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "order-service")
public interface OrderClient {
    @PostMapping("/order/addOrder/{userId}")
    Result addOrder(@RequestBody OrderDTO orderDTO, @PathVariable Integer userId);

    @GetMapping("/order/getOrderByTime/{current}/{num}/{userId}")
    Result getOrderByTime(@PathVariable Long current, @PathVariable Long num
            , @PathVariable Integer userId);

    @PostMapping("/order/getOrderGroup/{userId}")
    Result getOrderGroup(@RequestBody List<String> groupIds, @PathVariable Integer userId);

    @GetMapping("/order/getOrderByPriceScope/{current}/{num}/{userId}")
    Result getOrderByPriceScope(@PathVariable("current") Integer current,
                                @PathVariable("num") Integer num,
                                @RequestParam(required = false) Integer little,
                                @RequestParam(required = false) Integer big,
                                @PathVariable Integer userId);

    @GetMapping("/order/getOrder/{orderId}/{userId}")
    Result getOrder(@PathVariable Integer orderId, @PathVariable Integer userId);

    @GetMapping("/order/getOrderByProductName/{ProductCurrent}/{ProductPageNum}/{userId}")
    Result getOrderByProductName(@PathVariable Integer ProductCurrent,
                                 @PathVariable Integer ProductPageNum,
                                 @RequestParam("productName") String productName,
                                 @PathVariable Integer userId);
}
